/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.hugo.senai.relatorio;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author Simulado
 */
public class Visualiza {

    public void visualizar(int id) {
        try {
            HashMap parameterMap = new HashMap();

            parameterMap.put("ID_PROVA", id);
         //parameterMap.put("", id)

           String arquivo = "Prova.jasper";
           // InputStream arquivo = Visualiza.class.getResourceAsStream("Prova.jasper");

            JasperPrint jp = JasperFillManager.fillReport(arquivo, parameterMap, Conexao.getConnection());

            JasperViewer.viewReport(jp, false);

        } catch (Exception ex) {
            Logger.getLogger(Visualiza.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

}
